/*
 * @lc app=leetcode.cn id=728 lang=rust
 *
 * [728] 自除数
 */

// @lc code=start
impl Solution {
    pub fn self_dividing_numbers(left: i32, right: i32) -> Vec<i32> {
        let mut ret_vec = Vec::new();
        for i in left..right+1 {
            let mut j = i;
            let mut flag = true;//默认是自除数
            while j != 0{
                let tmp = j % 10;
                if tmp == 0 || i % tmp != 0{
                    flag = false;
                    break;
                }
                j /= 10;
            }
            if flag {
                ret_vec.push(i);
            }
        }
        return ret_vec;
    }
}
// @lc code=end

